/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note
 * Copyright (C) 2016-2018, LomboTech Co.Ltd.
 * Author: lomboswer <lomboswer@lombotech.com>
 *
 * sc2363p mipi-csi sensor driver code for LomboTech
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 */

#include <linux/init.h>
#include <linux/module.h>

#include <linux/slab.h>
#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/io.h>
#include <linux/viss_isp.h>

#include <media/lombo_viss.h>

#include <mach/debug.h>
#include "../ccc.h"

/*
 * 2lane YUV init
 */
static const cc_reg_t xc6130_init_reg_list[] = {
	{ 0xFFFD, 0x80 },
	{ 0xFFFE, 0x80 },
	{ 0x001c, 0xff },
	{ 0x001d, 0xff },
	{ 0x001e, 0xff },
	{ 0x001f, 0xef },
	{ 0x0018, 0x00 },
	{ 0x0019, 0x00 },
	{ 0x001a, 0x00 },
	{ 0x001b, 0x00 },
	{ 0x00bc, 0x19 },
	{ 0x00bd, 0x00 },
	{ 0x00be, 0x00 },
	{ 0x00bf, 0x00 },
	{ 0x0020, 0x01 },
	{ 0x0021, 0x0e },
	{ 0x0022, 0x00 },
	{ 0x0023, 0x00 },
	{ 0x0024, 0x04 },
	{ 0x0025, 0x0e },
	{ 0x0026, 0x01 },
	{ 0x0027, 0x0e },
	{ 0x0030, 0x61 },
	{ 0x0031, 0x20 },
	{ 0x0032, 0x70 },
	{ 0x0033, 0x12 },
	{ 0xfffe, 0x80 },
	{ 0x0050, 0x06 },
	{ 0x0054, 0x06 },
	{ 0x0058, 0x00 },
	{ 0x0058, 0x00 },
	{ 0x0058, 0x06 },
	{ 0xFFFE, 0x25 },
	{ 0x0002, 0x40 },
	{ 0xfffe, 0x26 },
	{ 0x0002, 0x00 },
	{ 0xfffe, 0x80 },
	{ 0x00bc, 0x91 },
	{ 0x001b, 0x00 },
	{ 0x0090, 0x28 },
	{ 0x0038, 0x03 },
	{ 0xfffe, 0x26 },
	{ 0x0000, 0x20 },
	{ 0x0002, 0x00 },
	{ 0x0009, 0x04 },
	{ 0x4000, 0xF9 },
	{ 0x6001, 0x17 },
	{ 0x6005, 0x04 },
	{ 0x6006, 0x0F },
	{ 0x6007, 0xA0 },
	{ 0x6008, 0x0E },
	{ 0x6009, 0xFC },
	{ 0x8000, 0x3f },
	{ 0x8001, 0x80 },
	{ 0x8002, 0x07 },
	{ 0x8003, 0x38 },
	{ 0x8004, 0x04 },
	{ 0x8005, 0x03 },
	{ 0x8006, 0x05 },
	{ 0x8007, 0x99 },
	{ 0x8010, 0x04 },
	{ 0x2019, 0x07 },
	{ 0x201a, 0x80 },
	{ 0x201b, 0x04 },
	{ 0x201c, 0x38 },
	{ 0x201d, 0x00 },
	{ 0x201e, 0x00 },
	{ 0x201f, 0x00 },
	{ 0x2020, 0x00 },
	{ 0x2015, 0x81 },
	{ 0x2017, 0x1e },
	{ 0x2018, 0x1e },
	{ 0x2023, 0x03 },
	{ 0x8012, 0x80 },
	{ 0x8013, 0x07 },
	{ 0x8014, 0x38 },
	{ 0x8015, 0x04 },
	{ 0x8016, 0x00 },
	{ 0x8017, 0x00 },
	{ 0x8018, 0x00 },
	{ 0x8019, 0x00 },
	{ 0xfffe, 0x21 },
	{ 0x0001, 0x01 },
	{ 0x0004, 0x10 },
	{ 0x0708, 0x00 },
	{ 0x0072, 0x00 },
	{ 0x0074, 0x00 },
	{ 0x0006, 0x07 },
	{ 0x0007, 0x80 },
	{ 0x0008, 0x04 },
	{ 0x0009, 0x38 },
	{ 0x000a, 0x07 },
	{ 0x000b, 0x80 },
	{ 0x000c, 0x04 },
	{ 0x000d, 0x38 },
	{ 0x001e, 0x07 },
	{ 0x001f, 0x80 },
	{ 0x0020, 0x04 },
	{ 0x0021, 0x38 },
	{ 0x005e, 0x7F },
	{ 0x005f, 0x07 },
	{ 0x0060, 0x37 },
	{ 0x0061, 0x04 },
	{ 0x0064, 0x80 },
	{ 0x0065, 0x07 },
	{ 0x0066, 0x38 },
	{ 0x0067, 0x04 },
	{ 0x0076, 0x07 },
	{ 0x0077, 0x80 },
	{ 0x0078, 0x04 },
	{ 0x0079, 0x38 },
	{ 0x0700, 0x00 },
	{ 0x0701, 0x00 },
	{ 0x0702, 0x00 },
	{ 0x0703, 0x00 },
	{ 0x0704, 0x07 },
	{ 0x0705, 0x80 },
	{ 0x0706, 0x04 },
	{ 0x0707, 0x38 },

	{ 0xfffe, 0x21 },
	{ 0x0005, 0x90 },
	{ 0x0013, 0x02 },
	{ 0x019b, 0x00 },
	{ 0xfffd, 0x80 },
	{ 0xfffe, 0x14 },
	{ 0x100c, 0x9c },
	{ 0x100d, 0x21 },
	{ 0x100e, 0xff },
	{ 0x100f, 0xf4 },
	{ 0x1010, 0xd4 },
	{ 0x1011, 0x01 },
	{ 0x1012, 0x48 },
	{ 0x1013, 0x00 },
	{ 0x1014, 0xd4 },
	{ 0x1015, 0x01 },
	{ 0x1016, 0x50 },
	{ 0x1017, 0x04 },
	{ 0x1018, 0xd4 },
	{ 0x1019, 0x01 },
	{ 0x101a, 0x60 },
	{ 0x101b, 0x08 },
	{ 0x101c, 0x19 },
	{ 0x101d, 0x80 },
	{ 0x101e, 0x00 },
	{ 0x101f, 0x14 },
	{ 0x1020, 0xa9 },
	{ 0x1021, 0x8c },
	{ 0x1022, 0x00 },
	{ 0x1023, 0x18 },
	{ 0x1024, 0x84 },
	{ 0x1025, 0x6c },
	{ 0x1026, 0x00 },
	{ 0x1027, 0x00 },
	{ 0x1028, 0x95 },
	{ 0x1029, 0x43 },
	{ 0x102a, 0x00 },
	{ 0x102b, 0x0a },
	{ 0x102c, 0x8c },
	{ 0x102d, 0xa3 },
	{ 0x102e, 0x00 },
	{ 0x102f, 0x1f },
	{ 0x1030, 0xb8 },
	{ 0x1031, 0x8a },
	{ 0x1032, 0x00 },
	{ 0x1033, 0x48 },
	{ 0x1034, 0x07 },
	{ 0x1035, 0xfb },
	{ 0x1036, 0x23 },
	{ 0x1037, 0x81 },
	{ 0x1038, 0x94 },
	{ 0x1039, 0x63 },
	{ 0x103a, 0x00 },
	{ 0x103b, 0x40 },
	{ 0x103c, 0x84 },
	{ 0x103d, 0x6c },
	{ 0x103e, 0x00 },
	{ 0x103f, 0x00 },
	{ 0x1040, 0xa4 },
	{ 0x1041, 0x8a },
	{ 0x1042, 0x00 },
	{ 0x1043, 0xff },
	{ 0x1044, 0x8c },
	{ 0x1045, 0xa3 },
	{ 0x1046, 0x00 },
	{ 0x1047, 0x1f },
	{ 0x1048, 0x07 },
	{ 0x1049, 0xfb },
	{ 0x104a, 0x23 },
	{ 0x104b, 0x7c },
	{ 0x104c, 0x94 },
	{ 0x104d, 0x63 },
	{ 0x104e, 0x00 },
	{ 0x104f, 0x42 },
	{ 0x1050, 0x84 },
	{ 0x1051, 0xcc },
	{ 0x1052, 0x00 },
	{ 0x1053, 0x00 },
	{ 0x1054, 0x8c },
	{ 0x1055, 0x66 },
	{ 0x1056, 0x00 },
	{ 0x1057, 0x00 },
	{ 0x1058, 0xbc },
	{ 0x1059, 0x23 },
	{ 0x105a, 0x00 },
	{ 0x105b, 0x01 },
	{ 0x105c, 0x0c },
	{ 0x105d, 0x00 },
	{ 0x105e, 0x00 },
	{ 0x105f, 0x3f },
	{ 0x1060, 0x18 },
	{ 0x1061, 0x60 },
	{ 0x1062, 0x80 },
	{ 0x1063, 0x21 },
	{ 0x1064, 0xa8 },
	{ 0x1065, 0x83 },
	{ 0x1066, 0x11 },
	{ 0x1067, 0x0a },
	{ 0x1068, 0xa8 },
	{ 0x1069, 0xa3 },
	{ 0x106a, 0x11 },
	{ 0x106b, 0x0b },
	{ 0x106c, 0x8c },
	{ 0x106d, 0x64 },
	{ 0x106e, 0x00 },
	{ 0x106f, 0x00 },
	{ 0x1070, 0x8c },
	{ 0x1071, 0x85 },
	{ 0x1072, 0x00 },
	{ 0x1073, 0x00 },
	{ 0x1074, 0xb8 },
	{ 0x1075, 0x63 },
	{ 0x1076, 0x00 },
	{ 0x1077, 0x08 },
	{ 0x1078, 0xe0 },
	{ 0x1079, 0x63 },
	{ 0x107a, 0x20 },
	{ 0x107b, 0x00 },
	{ 0x107c, 0xd4 },
	{ 0x107d, 0x06 },
	{ 0x107e, 0x18 },
	{ 0x107f, 0x08 },
	{ 0x1080, 0x84 },
	{ 0x1081, 0x6c },
	{ 0x1082, 0x00 },
	{ 0x1083, 0x00 },
	{ 0x1084, 0x84 },
	{ 0x1085, 0x63 },
	{ 0x1086, 0x00 },
	{ 0x1087, 0x08 },
	{ 0x1088, 0xbc },
	{ 0x1089, 0x43 },
	{ 0x108a, 0x00 },
	{ 0x108b, 0x1e },
	{ 0x108c, 0x10 },
	{ 0x108d, 0x00 },
	{ 0x108e, 0x00 },
	{ 0x108f, 0x12 },
	{ 0x1090, 0xbc },
	{ 0x1091, 0x43 },
	{ 0x1092, 0x00 },
	{ 0x1093, 0x2e },
	{ 0x1094, 0x18 },
	{ 0x1095, 0x60 },
	{ 0x1096, 0x00 },
	{ 0x1097, 0x14 },
	{ 0x1098, 0xa8 },
	{ 0x1099, 0x63 },
	{ 0x109a, 0x10 },
	{ 0x109b, 0x00 },
	{ 0x109c, 0x8c },
	{ 0x109d, 0x83 },
	{ 0x109e, 0x00 },
	{ 0x109f, 0x00 },
	{ 0x10a0, 0x18 },
	{ 0x10a1, 0x60 },
	{ 0x10a2, 0x00 },
	{ 0x10a3, 0x14 },
	{ 0x10a4, 0xa8 },
	{ 0x10a5, 0x63 },
	{ 0x10a6, 0x10 },
	{ 0x10a7, 0x01 },
	{ 0x10a8, 0x8c },
	{ 0x10a9, 0x63 },
	{ 0x10aa, 0x00 },
	{ 0x10ab, 0x00 },
	{ 0x10ac, 0xa8 },
	{ 0x10ad, 0xa4 },
	{ 0x10ae, 0x00 },
	{ 0x10af, 0x00 },
	{ 0x10b0, 0xa8 },
	{ 0x10b1, 0x83 },
	{ 0x10b2, 0x00 },
	{ 0x10b3, 0x00 },
	{ 0x10b4, 0x18 },
	{ 0x10b5, 0x60 },
	{ 0x10b6, 0x80 },
	{ 0x10b7, 0x80 },
	{ 0x10b8, 0xa8 },
	{ 0x10b9, 0x63 },
	{ 0x10ba, 0x01 },
	{ 0x10bb, 0x2c },
	{ 0x10bc, 0x8c },
	{ 0x10bd, 0x63 },
	{ 0x10be, 0x00 },
	{ 0x10bf, 0x00 },
	{ 0x10c0, 0xbc },
	{ 0x10c1, 0x23 },
	{ 0x10c2, 0x00 },
	{ 0x10c3, 0x01 },
	{ 0x10c4, 0x10 },
	{ 0x10c5, 0x00 },
	{ 0x10c6, 0x00 },
	{ 0x10c7, 0x53 },
	{ 0x10c8, 0x18 },
	{ 0x10c9, 0x60 },
	{ 0x10ca, 0x80 },
	{ 0x10cb, 0x21 },
	{ 0x10cc, 0x00 },
	{ 0x10cd, 0x00 },
	{ 0x10ce, 0x00 },
	{ 0x10cf, 0x13 },
	{ 0x10d0, 0xa8 },
	{ 0x10d1, 0xc3 },
	{ 0x10d2, 0x05 },
	{ 0x10d3, 0x81 },
	{ 0x10d4, 0x10 },
	{ 0x10d5, 0x00 },
	{ 0x10d6, 0x00 },
	{ 0x10d7, 0x16 },
	{ 0x10d8, 0xbc },
	{ 0x10d9, 0x43 },
	{ 0x10da, 0x00 },
	{ 0x10db, 0x3e },
	{ 0x10dc, 0x18 },
	{ 0x10dd, 0x60 },
	{ 0x10de, 0x00 },
	{ 0x10df, 0x14 },
	{ 0x10e0, 0xa8 },
	{ 0x10e1, 0x63 },
	{ 0x10e2, 0x10 },
	{ 0x10e3, 0x02 },
	{ 0x10e4, 0x8c },
	{ 0x10e5, 0x83 },
	{ 0x10e6, 0x00 },
	{ 0x10e7, 0x00 },
	{ 0x10e8, 0x18 },
	{ 0x10e9, 0x60 },
	{ 0x10ea, 0x00 },
	{ 0x10eb, 0x14 },
	{ 0x10ec, 0xa8 },
	{ 0x10ed, 0x63 },
	{ 0x10ee, 0x10 },
	{ 0x10ef, 0x03 },
	{ 0x10f0, 0xa8 },
	{ 0x10f1, 0xa4 },
	{ 0x10f2, 0x00 },
	{ 0x10f3, 0x00 },
	{ 0x10f4, 0x8c },
	{ 0x10f5, 0x63 },
	{ 0x10f6, 0x00 },
	{ 0x10f7, 0x00 },
	{ 0x10f8, 0xa8 },
	{ 0x10f9, 0x83 },
	{ 0x10fa, 0x00 },
	{ 0x10fb, 0x00 },
	{ 0x10fc, 0x18 },
	{ 0x10fd, 0x60 },
	{ 0x10fe, 0x80 },
	{ 0x10ff, 0x80 },
	{ 0x1100, 0xa8 },
	{ 0x1101, 0x63 },
	{ 0x1102, 0x01 },
	{ 0x1103, 0x2c },
	{ 0x1104, 0x8c },
	{ 0x1105, 0x63 },
	{ 0x1106, 0x00 },
	{ 0x1107, 0x00 },
	{ 0x1108, 0xbc },
	{ 0x1109, 0x23 },
	{ 0x110a, 0x00 },
	{ 0x110b, 0x01 },
	{ 0x110c, 0x10 },
	{ 0x110d, 0x00 },
	{ 0x110e, 0x00 },
	{ 0x110f, 0x41 },
	{ 0x1110, 0x18 },
	{ 0x1111, 0x60 },
	{ 0x1112, 0x80 },
	{ 0x1113, 0x21 },
	{ 0x1114, 0xa8 },
	{ 0x1115, 0xc3 },
	{ 0x1116, 0x05 },
	{ 0x1117, 0x81 },
	{ 0x1118, 0xa8 },
	{ 0x1119, 0x63 },
	{ 0x111a, 0x05 },
	{ 0x111b, 0x82 },
	{ 0x111c, 0xd8 },
	{ 0x111d, 0x06 },
	{ 0x111e, 0x28 },
	{ 0x111f, 0x00 },
	{ 0x1120, 0xd8 },
	{ 0x1121, 0x03 },
	{ 0x1122, 0x20 },
	{ 0x1123, 0x00 },
	{ 0x1124, 0x00 },
	{ 0x1125, 0x00 },
	{ 0x1126, 0x00 },
	{ 0x1127, 0x3b },
	{ 0x1128, 0x15 },
	{ 0x1129, 0x00 },
	{ 0x112a, 0x00 },
	{ 0x112b, 0x00 },
	{ 0x112c, 0x0c },
	{ 0x112d, 0x00 },
	{ 0x112e, 0x00 },
	{ 0x112f, 0x22 },
	{ 0x1130, 0xbc },
	{ 0x1131, 0x43 },
	{ 0x1132, 0x00 },
	{ 0x1133, 0x4e },
	{ 0x1134, 0x10 },
	{ 0x1135, 0x00 },
	{ 0x1136, 0x00 },
	{ 0x1137, 0x27 },
	{ 0x1138, 0xbc },
	{ 0x1139, 0x43 },
	{ 0x113a, 0x00 },
	{ 0x113b, 0x5e },
	{ 0x113c, 0x18 },
	{ 0x113d, 0x60 },
	{ 0x113e, 0x00 },
	{ 0x113f, 0x14 },
	{ 0x1140, 0xa8 },
	{ 0x1141, 0x63 },
	{ 0x1142, 0x10 },
	{ 0x1143, 0x06 },
	{ 0x1144, 0x8c },
	{ 0x1145, 0x83 },
	{ 0x1146, 0x00 },
	{ 0x1147, 0x00 },
	{ 0x1148, 0x18 },
	{ 0x1149, 0x60 },
	{ 0x114a, 0x00 },
	{ 0x114b, 0x14 },
	{ 0x114c, 0xa8 },
	{ 0x114d, 0x63 },
	{ 0x114e, 0x10 },
	{ 0x114f, 0x07 },
	{ 0x1150, 0x03 },
	{ 0x1151, 0xff },
	{ 0x1152, 0xff },
	{ 0x1153, 0xd6 },
	{ 0x1154, 0x15 },
	{ 0x1155, 0x00 },
	{ 0x1156, 0x00 },
	{ 0x1157, 0x00 },
	{ 0x1158, 0x18 },
	{ 0x1159, 0xa0 },
	{ 0x115a, 0x80 },
	{ 0x115b, 0x14 },
	{ 0x115c, 0xa8 },
	{ 0x115d, 0x65 },
	{ 0x115e, 0x00 },
	{ 0x115f, 0x2a },
	{ 0x1160, 0x8c },
	{ 0x1161, 0x63 },
	{ 0x1162, 0x00 },
	{ 0x1163, 0x00 },
	{ 0x1164, 0xbc },
	{ 0x1165, 0xa3 },
	{ 0x1166, 0x00 },
	{ 0x1167, 0x07 },
	{ 0x1168, 0x10 },
	{ 0x1169, 0x00 },
	{ 0x116a, 0x00 },
	{ 0x116b, 0x0b },
	{ 0x116c, 0x18 },
	{ 0x116d, 0x80 },
	{ 0x116e, 0x80 },
	{ 0x116f, 0x21 },
	{ 0x1170, 0x18 },
	{ 0x1171, 0x60 },
	{ 0x1172, 0x80 },
	{ 0x1173, 0x21 },
	{ 0x1174, 0x9c },
	{ 0x1175, 0xa0 },
	{ 0x1176, 0x00 },
	{ 0x1177, 0x07 },
	{ 0x1178, 0xa8 },
	{ 0x1179, 0x83 },
	{ 0x117a, 0x11 },
	{ 0x117b, 0x0a },
	{ 0x117c, 0xd8 },
	{ 0x117d, 0x04 },
	{ 0x117e, 0x28 },
	{ 0x117f, 0x00 },
	{ 0x1180, 0xa8 },
	{ 0x1181, 0x63 },
	{ 0x1182, 0x11 },
	{ 0x1183, 0x0b },
	{ 0x1184, 0x9c },
	{ 0x1185, 0x80 },
	{ 0x1186, 0xff },
	{ 0x1187, 0xff },
	{ 0x1188, 0xd8 },
	{ 0x1189, 0x03 },
	{ 0x118a, 0x20 },
	{ 0x118b, 0x00 },
	{ 0x118c, 0x03 },
	{ 0x118d, 0xff },
	{ 0x118e, 0xff },
	{ 0x118f, 0xbe },
	{ 0x1190, 0x84 },
	{ 0x1191, 0x6c },
	{ 0x1192, 0x00 },
	{ 0x1193, 0x00 },
	{ 0x1194, 0xa8 },
	{ 0x1195, 0xc5 },
	{ 0x1196, 0x00 },
	{ 0x1197, 0x2b },
	{ 0x1198, 0xa8 },
	{ 0x1199, 0xa4 },
	{ 0x119a, 0x11 },
	{ 0x119b, 0x0a },
	{ 0x119c, 0xd8 },
	{ 0x119d, 0x05 },
	{ 0x119e, 0x18 },
	{ 0x119f, 0x00 },
	{ 0x11a0, 0xa8 },
	{ 0x11a1, 0x84 },
	{ 0x11a2, 0x11 },
	{ 0x11a3, 0x0b },
	{ 0x11a4, 0x8c },
	{ 0x11a5, 0x66 },
	{ 0x11a6, 0x00 },
	{ 0x11a7, 0x00 },
	{ 0x11a8, 0xd8 },
	{ 0x11a9, 0x04 },
	{ 0x11aa, 0x18 },
	{ 0x11ab, 0x00 },
	{ 0x11ac, 0x03 },
	{ 0x11ad, 0xff },
	{ 0x11ae, 0xff },
	{ 0x11af, 0xb6 },
	{ 0x11b0, 0x84 },
	{ 0x11b1, 0x6c },
	{ 0x11b2, 0x00 },
	{ 0x11b3, 0x00 },
	{ 0x11b4, 0x18 },
	{ 0x11b5, 0x60 },
	{ 0x11b6, 0x00 },
	{ 0x11b7, 0x14 },
	{ 0x11b8, 0xa8 },
	{ 0x11b9, 0x63 },
	{ 0x11ba, 0x10 },
	{ 0x11bb, 0x04 },
	{ 0x11bc, 0x8c },
	{ 0x11bd, 0x83 },
	{ 0x11be, 0x00 },
	{ 0x11bf, 0x00 },
	{ 0x11c0, 0x18 },
	{ 0x11c1, 0x60 },
	{ 0x11c2, 0x00 },
	{ 0x11c3, 0x14 },
	{ 0x11c4, 0xa8 },
	{ 0x11c5, 0x63 },
	{ 0x11c6, 0x10 },
	{ 0x11c7, 0x05 },
	{ 0x11c8, 0x03 },
	{ 0x11c9, 0xff },
	{ 0x11ca, 0xff },
	{ 0x11cb, 0xb8 },
	{ 0x11cc, 0x15 },
	{ 0x11cd, 0x00 },
	{ 0x11ce, 0x00 },
	{ 0x11cf, 0x00 },
	{ 0x11d0, 0x10 },
	{ 0x11d1, 0x00 },
	{ 0x11d2, 0x00 },
	{ 0x11d3, 0x09 },
	{ 0x11d4, 0x15 },
	{ 0x11d5, 0x00 },
	{ 0x11d6, 0x00 },
	{ 0x11d7, 0x00 },
	{ 0x11d8, 0x18 },
	{ 0x11d9, 0x60 },
	{ 0x11da, 0x00 },
	{ 0x11db, 0x14 },
	{ 0x11dc, 0xa8 },
	{ 0x11dd, 0x63 },
	{ 0x11de, 0x10 },
	{ 0x11df, 0x08 },
	{ 0x11e0, 0x8c },
	{ 0x11e1, 0x83 },
	{ 0x11e2, 0x00 },
	{ 0x11e3, 0x00 },
	{ 0x11e4, 0x18 },
	{ 0x11e5, 0x60 },
	{ 0x11e6, 0x00 },
	{ 0x11e7, 0x14 },
	{ 0x11e8, 0xa8 },
	{ 0x11e9, 0x63 },
	{ 0x11ea, 0x10 },
	{ 0x11eb, 0x09 },
	{ 0x11ec, 0x03 },
	{ 0x11ed, 0xff },
	{ 0x11ee, 0xff },
	{ 0x11ef, 0xaf },
	{ 0x11f0, 0x15 },
	{ 0x11f1, 0x00 },
	{ 0x11f2, 0x00 },
	{ 0x11f3, 0x00 },
	{ 0x11f4, 0x18 },
	{ 0x11f5, 0x60 },
	{ 0x11f6, 0x00 },
	{ 0x11f7, 0x14 },
	{ 0x11f8, 0xa8 },
	{ 0x11f9, 0x63 },
	{ 0x11fa, 0x10 },
	{ 0x11fb, 0x0a },
	{ 0x11fc, 0x8c },
	{ 0x11fd, 0x83 },
	{ 0x11fe, 0x00 },
	{ 0x11ff, 0x00 },
	{ 0x1200, 0x18 },
	{ 0x1201, 0x60 },
	{ 0x1202, 0x00 },
	{ 0x1203, 0x14 },
	{ 0x1204, 0xa8 },
	{ 0x1205, 0x63 },
	{ 0x1206, 0x10 },
	{ 0x1207, 0x0b },
	{ 0x1208, 0x03 },
	{ 0x1209, 0xff },
	{ 0x120a, 0xff },
	{ 0x120b, 0xa8 },
	{ 0x120c, 0x15 },
	{ 0x120d, 0x00 },
	{ 0x120e, 0x00 },
	{ 0x120f, 0x00 },
	{ 0x1210, 0x85 },
	{ 0x1211, 0x21 },
	{ 0x1212, 0x00 },
	{ 0x1213, 0x00 },
	{ 0x1214, 0x85 },
	{ 0x1215, 0x41 },
	{ 0x1216, 0x00 },
	{ 0x1217, 0x04 },
	{ 0x1218, 0x85 },
	{ 0x1219, 0x81 },
	{ 0x121a, 0x00 },
	{ 0x121b, 0x08 },
	{ 0x121c, 0x44 },
	{ 0x121d, 0x00 },
	{ 0x121e, 0x48 },
	{ 0x121f, 0x00 },
	{ 0x1220, 0x9c },
	{ 0x1221, 0x21 },
	{ 0x1222, 0x00 },
	{ 0x1223, 0x0c },
	{ 0x1224, 0x9c },
	{ 0x1225, 0x21 },
	{ 0x1226, 0xff },
	{ 0x1227, 0xec },
	{ 0x1228, 0xd4 },
	{ 0x1229, 0x01 },
	{ 0x122a, 0x48 },
	{ 0x122b, 0x00 },
	{ 0x122c, 0xd4 },
	{ 0x122d, 0x01 },
	{ 0x122e, 0x50 },
	{ 0x122f, 0x04 },
	{ 0x1230, 0xd4 },
	{ 0x1231, 0x01 },
	{ 0x1232, 0x60 },
	{ 0x1233, 0x08 },
	{ 0x1234, 0xd4 },
	{ 0x1235, 0x01 },
	{ 0x1236, 0x70 },
	{ 0x1237, 0x0c },
	{ 0x1238, 0xd4 },
	{ 0x1239, 0x01 },
	{ 0x123a, 0x80 },
	{ 0x123b, 0x10 },
	{ 0x123c, 0x19 },
	{ 0x123d, 0x80 },
	{ 0x123e, 0x00 },
	{ 0x123f, 0x14 },
	{ 0x1240, 0xa9 },
	{ 0x1241, 0x8c }, /* separate patch on/off */
	{ 0x1242, 0x00 },
	{ 0x1243, 0x18 },
	{ 0x1244, 0x84 },
	{ 0x1245, 0x6c }, /* patch start address */
	{ 0x1246, 0x00 }, /* double check */
	{ 0x1247, 0x00 },
	{ 0x1248, 0x84 },
	{ 0x1249, 0x83 },
	{ 0x124a, 0x00 },
	{ 0x124b, 0x04 },
	{ 0x124c, 0x18 }, /* 0x30bb default value */
	{ 0x124d, 0x60 }, /* saturation setting */
	{ 0x124e, 0x00 }, /* sat_u1(gain < 1f) */
	{ 0x124f, 0xff }, /* sat_v2 */
	{ 0x1250, 0xa8 }, /* sat_u2(gain < 2f) */
	{ 0x1251, 0x63 }, /* sat_v2 */
	{ 0x1252, 0xff }, /* sat_u3(gain < 3f) */
	{ 0x1253, 0xf0 }, /* sat_v3 */
	{ 0x1254, 0xe1 }, /* sat_u4(gain < 4f) */
	{ 0x1255, 0x44 }, /* sat_v4 */
	{ 0x1256, 0x18 }, /* sat_u5(gain < 5f) */
	{ 0x1257, 0x03 }, /* sat_v5 */
	{ 0x1258, 0xb9 },
	{ 0x1259, 0xca },
	{ 0x125a, 0x00 },
	{ 0x125b, 0x48 }, /* 01 by leo */
	{ 0x125c, 0xa4 },
	{ 0x125d, 0x6e }, /* patch on/ off */
	{ 0x125e, 0x00 },
	{ 0x125f, 0xff }, /* expo */
	{ 0x1260, 0xbc },
	{ 0x1261, 0xa3 },
	{ 0x1262, 0x00 },
	{ 0x1263, 0x0a },
	{ 0x1264, 0x0c },
	{ 0x1265, 0x00 },
	{ 0x1266, 0x00 },
	{ 0x1267, 0x05 },
	{ 0x1268, 0x9c },
	{ 0x1269, 0xa0 },
	{ 0x126a, 0x00 },
	{ 0x126b, 0x02 },
	{ 0x126c, 0xbc },
	{ 0x126d, 0x43 },
	{ 0x126e, 0x00 },
	{ 0x126f, 0x04 }, /* double check */
	{ 0x1270, 0x10 },
	{ 0x1271, 0x00 },
	{ 0x1272, 0x00 },
	{ 0x1273, 0x2a },
	{ 0x1274, 0x9c },
	{ 0x1275, 0xa0 },
	{ 0x1276, 0x00 },
	{ 0x1277, 0x12 },
	{ 0x1278, 0x84 },
	{ 0x1279, 0x6c },
	{ 0x127a, 0x00 },
	{ 0x127b, 0x00 },
	{ 0x127c, 0xa8 },
	{ 0x127d, 0x85 },
	{ 0x127e, 0x00 },
	{ 0x127f, 0x00 },
	{ 0x1280, 0x8c }, /* 18 */
	{ 0x1281, 0xa3 },
	{ 0x1282, 0x00 },
	{ 0x1283, 0x1f },
	{ 0x1284, 0x07 },
	{ 0x1285, 0xfb },
	{ 0x1286, 0x22 },
	{ 0x1287, 0xed }, /* 40 */
	{ 0x1288, 0x9c },
	{ 0x1289, 0x60 },
	{ 0x128a, 0x33 },
	{ 0x128b, 0x14 },
	{ 0x128c, 0x84 },
	{ 0x128d, 0x6c },
	{ 0x128e, 0x00 },
	{ 0x128f, 0x00 },
	{ 0x1290, 0xb8 },
	{ 0x1291, 0x8a },
	{ 0x1292, 0x00 },
	{ 0x1293, 0x50 },
	{ 0x1294, 0x8c },
	{ 0x1295, 0xa3 },
	{ 0x1296, 0x00 },
	{ 0x1297, 0x1f },
	{ 0x1298, 0x07 },
	{ 0x1299, 0xfb },
	{ 0x129a, 0x22 },
	{ 0x129b, 0xe8 },
	{ 0x129c, 0x94 },
	{ 0x129d, 0x63 },
	{ 0x129e, 0x00 },
	{ 0x129f, 0x20 },
	{ 0x12a0, 0x84 },
	{ 0x12a1, 0x6c },
	{ 0x12a2, 0x00 }, /* LENC start 70% */
	{ 0x12a3, 0x00 },
	{ 0x12a4, 0xa4 },
	{ 0x12a5, 0x8e },
	{ 0x12a6, 0x00 },
	{ 0x12a7, 0xff },
	{ 0x12a8, 0x8c },
	{ 0x12a9, 0xa3 },
	{ 0x12aa, 0x00 },
	{ 0x12ab, 0x1f },
	{ 0x12ac, 0x07 },
	{ 0x12ad, 0xfb },
	{ 0x12ae, 0x22 },
	{ 0x12af, 0xe3 },
	{ 0x12b0, 0x94 },
	{ 0x12b1, 0x63 },
	{ 0x12b2, 0x00 },
	{ 0x12b3, 0x22 },
	{ 0x12b4, 0x84 },
	{ 0x12b5, 0x6c },
	{ 0x12b6, 0x00 },
	{ 0x12b7, 0x00 },
	{ 0x12b8, 0xa4 },
	{ 0x12b9, 0x8a },
	{ 0x12ba, 0x00 },
	{ 0x12bb, 0xf0 },
	{ 0x12bc, 0x8c },
	{ 0x12bd, 0xa3 },
	{ 0x12be, 0x00 },
	{ 0x12bf, 0x1f },
	{ 0x12c0, 0x9d },
	{ 0x12c1, 0x40 },
	{ 0x12c2, 0x00 },
	{ 0x12c3, 0x06 },
	{ 0x12c4, 0x07 },
	{ 0x12c5, 0xfb },
	{ 0x12c6, 0x22 },
	{ 0x12c7, 0xdd },
	{ 0x12c8, 0x94 },
	{ 0x12c9, 0x63 },
	{ 0x12ca, 0x00 },
	{ 0x12cb, 0x24 },
	{ 0x12cc, 0x84 },
	{ 0x12cd, 0x6c },
	{ 0x12ce, 0x00 },
	{ 0x12cf, 0x00 },
	{ 0x12d0, 0x94 },
	{ 0x12d1, 0x63 },
	{ 0x12d2, 0x00 },
	{ 0x12d3, 0x0a },
	{ 0x12d4, 0xbc },
	{ 0x12d5, 0x43 },
	{ 0x12d6, 0x00 },
	{ 0x12d7, 0x1f },
	{ 0x12d8, 0x0c },
	{ 0x12d9, 0x00 },
	{ 0x12da, 0x00 },
	{ 0x12db, 0x06 },
	{ 0x12dc, 0x9e },
	{ 0x12dd, 0x00 },
	{ 0x12de, 0x00 },
	{ 0x12df, 0x48 },
	{ 0x12e0, 0xbc },
	{ 0x12e1, 0x43 },
	{ 0x12e2, 0x00 },
	{ 0x12e3, 0x3f },
	{ 0x12e4, 0x10 },
	{ 0x12e5, 0x00 },
	{ 0x12e6, 0x00 },
	{ 0x12e7, 0x05 },
	{ 0x12e8, 0x9d },
	{ 0x12e9, 0x40 },
	{ 0x12ea, 0x00 },
	{ 0x12eb, 0x14 }, /* AWB_init */
	{ 0x12ec, 0x9e },
	{ 0x12ed, 0x00 },
	{ 0x12ee, 0x00 }, /* B */
	{ 0x12ef, 0x48 },
	{ 0x12f0, 0x00 }, /* Gb */
	{ 0x12f1, 0x00 },
	{ 0x12f2, 0x00 }, /* Gr */
	{ 0x12f3, 0x13 },
	{ 0x12f4, 0x9d }, /* R */
	{ 0x12f5, 0xc0 },
	{ 0x12f6, 0x00 }, /* B_buff */
	{ 0x12f7, 0x08 },
	{ 0x12f8, 0xbc }, /* G_buff */
	{ 0x12f9, 0x43 },
	{ 0x12fa, 0x00 }, /* R_buff */
	{ 0x12fb, 0x7f },
	{ 0x12fc, 0x0f },
	{ 0x12fd, 0xff }, /* C_AWB */
	{ 0x12fe, 0xff },
	{ 0x12ff, 0xfc },
	{ 0x1300, 0x9d },
	{ 0x1301, 0x40 },
	{ 0x1302, 0x00 },
	{ 0x1303, 0x18 },
	{ 0x1304, 0xbc },
	{ 0x1305, 0x43 },
	{ 0x1306, 0x00 },
	{ 0x1307, 0xf7 },
	{ 0x1308, 0x10 },
	{ 0x1309, 0x00 }, /* 80 */
	{ 0x130a, 0x00 }, /* f1 */
	{ 0x130b, 0x06 },
	{ 0x130c, 0xbc },
	{ 0x130d, 0x43 },
	{ 0x130e, 0x01 },
	{ 0x130f, 0xef }, /* win1 startx */
	{ 0x1310, 0x03 }, /* win1 endx */
	{ 0x1311, 0xff }, /* win1 starty */
	{ 0x1312, 0xff }, /* win1 endy */
	{ 0x1313, 0xf7 }, /* win2 startx */
	{ 0x1314, 0x9d }, /* win2 endx */
	{ 0x1315, 0x40 }, /* win2 starty */
	{ 0x1316, 0x00 }, /* win2 endy */
	{ 0x1317, 0x13 }, /* win3 startx */
	{ 0x1318, 0x03 }, /* win3 endx */
	{ 0x1319, 0xff }, /* win3 starty */
	{ 0x131a, 0xff }, /* win3 endy */
	{ 0x131b, 0xd8 }, /* win4 startx */
	{ 0x131c, 0x9c }, /* win4 endx */
	{ 0x131d, 0xa0 }, /* win4 starty */
	{ 0x131e, 0x00 }, /* win4 endy */
	{ 0x131f, 0x08 }, /* win5 startx */
	{ 0x1320, 0x10 }, /* win5 endx */
	{ 0x1321, 0x00 }, /* win5 starty */
	{ 0x1322, 0x00 }, /* win5 endy */
	{ 0x1323, 0x05 }, /* win6 startx */
	{ 0x1324, 0x9d }, /* win6 endx */
	{ 0x1325, 0x40 }, /* win6 starty */
	{ 0x1326, 0x00 }, /* win6 endy */
	{ 0x1327, 0xa1 }, /* win7 startx */
	{ 0x1328, 0x9e }, /* win7 endx */
	{ 0x1329, 0x00 }, /* win7 starty */
	{ 0x132a, 0x00 }, /* win7 endy */
	{ 0x132b, 0x78 }, /* win8 startx */
	{ 0x132c, 0x00 }, /* win8 endx */
	{ 0x132d, 0x00 }, /* win8 starty */
	{ 0x132e, 0x00 }, /* win8 endy */
	{ 0x132f, 0x04 }, /* win9 startx */
	{ 0x1330, 0x9d }, /* win9 endx */
	{ 0x1331, 0xc0 }, /* win9 starty */
	{ 0x1332, 0x00 }, /* win9 endy */
	{ 0x1333, 0x48 }, /* win10 startx */
	{ 0x1334, 0x9d }, /* win10 endx */
	{ 0x1335, 0xc0 }, /* win10 starty */
	{ 0x1336, 0x00 }, /* win10 endy */
	{ 0x1337, 0x78 }, /* win11 startx */
	{ 0x1338, 0xaa }, /* win11 endx */
	{ 0x1339, 0x0e }, /* win11 starty */
	{ 0x133a, 0x00 }, /* win11 endy */
	{ 0x133b, 0x00 }, /* win12 startx */
	{ 0x133c, 0x84 }, /* win12 endx */
	{ 0x133d, 0x8c }, /* win12 starty */
	{ 0x133e, 0x00 }, /* win12 endy */
	{ 0x133f, 0x00 }, /* win13 startx */
	{ 0x1340, 0x9c }, /* win13 endx */
	{ 0x1341, 0x60 }, /* win13 starty */
	{ 0x1342, 0x38 }, /* win13 endy */
	{ 0x1343, 0x12 }, /* win14 startx */
	{ 0x1344, 0x8c }, /* win14 endx */
	{ 0x1345, 0xa4 }, /* win14 starty */
	{ 0x1346, 0x00 }, /* win14 endy */
	{ 0x1347, 0x1f }, /* win15 startx */
	{ 0x1348, 0x07 }, /* win15 endx */
	{ 0x1349, 0xfb }, /* win15 starty */
	{ 0x134a, 0x22 }, /* win15 endy */
	{ 0x134b, 0xbc }, /* win16 startx */
	{ 0x134c, 0x9c }, /* win16 endx */
	{ 0x134d, 0x80 }, /* win16 starty */
	{ 0x134e, 0x00 }, /* win16 endy */
	{ 0x134f, 0x00 }, /* wt1 wt2 */
	{ 0x1350, 0x84 }, /* wt3 wt4 */
	{ 0x1351, 0x6c }, /* wt5 wt6 */
	{ 0x1352, 0x00 }, /* wt7 wt8 */
	{ 0x1353, 0x00 }, /* wt9 wt10 */
	{ 0x1354, 0xa8 }, /* wt11 wt12 */
	{ 0x1355, 0x8a }, /* wt13 wt14 */
	{ 0x1356, 0x00 }, /* wt15 wt16 */
	{ 0x1357, 0x00 }, /* gamma */
	{ 0x1358, 0x8c },
	{ 0x1359, 0xa3 },
	{ 0x135a, 0x00 },
	{ 0x135b, 0x1f },
	{ 0x135c, 0x07 },
	{ 0x135d, 0xfb },
	{ 0x135e, 0x22 },
	{ 0x135f, 0xb7 },
	{ 0x1360, 0x9c },
	{ 0x1361, 0x60 },
	{ 0x1362, 0x33 },
	{ 0x1363, 0x01 },
	{ 0x1364, 0x84 },
	{ 0x1365, 0x6c },
	{ 0x1366, 0x00 },
	{ 0x1367, 0x00 },
	{ 0x1368, 0xa8 },
	{ 0x1369, 0x90 }, /* CMX */
	{ 0x136a, 0x00 },
	{ 0x136b, 0x00 },
	{ 0x136c, 0x8c },
	{ 0x136d, 0xa3 },
	{ 0x136e, 0x00 },
	{ 0x136f, 0x1f },
	{ 0x1370, 0x07 },
	{ 0x1371, 0xfb },
	{ 0x1372, 0x22 },
	{ 0x1373, 0xb2 },
	{ 0x1374, 0x9c },
	{ 0x1375, 0x60 },
	{ 0x1376, 0x33 },
	{ 0x1377, 0x06 },
	{ 0x1378, 0x84 },
	{ 0x1379, 0x6c },
	{ 0x137a, 0x00 },
	{ 0x137b, 0x00 },
	{ 0x137c, 0xa8 },
	{ 0x137d, 0x8e },
	{ 0x137e, 0x00 },
	{ 0x137f, 0x00 },
	{ 0x1380, 0x8c },
	{ 0x1381, 0xa3 },
	{ 0x1382, 0x00 },
	{ 0x1383, 0x1f },
	{ 0x1384, 0x07 },
	{ 0x1385, 0xfb },
	{ 0x1386, 0x22 },
	{ 0x1387, 0xad },
	{ 0x1388, 0x9c },
	{ 0x1389, 0x60 },
	{ 0x138a, 0x36 },
	{ 0x138b, 0x32 },
	{ 0x138c, 0x84 },
	{ 0x138d, 0x8c },
	{ 0x138e, 0x00 },
	{ 0x138f, 0x00 },
	{ 0x1390, 0x9c },
	{ 0x1391, 0x60 },
	{ 0x1392, 0x38 },
	{ 0x1393, 0x12 },
	{ 0x1394, 0x8c },
	{ 0x1395, 0xa4 },
	{ 0x1396, 0x00 },
	{ 0x1397, 0x1f },
	{ 0x1398, 0x07 },
	{ 0x1399, 0xfb }, /* CIP start */
	{ 0x139a, 0x22 },
	{ 0x139b, 0xa8 },
	{ 0x139c, 0x9c },
	{ 0x139d, 0x80 },
	{ 0x139e, 0x00 },
	{ 0x139f, 0x30 },
	{ 0x13a0, 0x85 },
	{ 0x13a1, 0x21 },
	{ 0x13a2, 0x00 },
	{ 0x13a3, 0x00 },
	{ 0x13a4, 0x85 },
	{ 0x13a5, 0x41 },
	{ 0x13a6, 0x00 },
	{ 0x13a7, 0x04 },
	{ 0x13a8, 0x85 },
	{ 0x13a9, 0x81 },
	{ 0x13aa, 0x00 },
	{ 0x13ab, 0x08 },
	{ 0x13ac, 0x85 },
	{ 0x13ad, 0xc1 },
	{ 0x13ae, 0x00 },
	{ 0x13af, 0x0c },
	{ 0x13b0, 0x86 },
	{ 0x13b1, 0x01 },
	{ 0x13b2, 0x00 },
	{ 0x13b3, 0x10 },
	{ 0x13b4, 0x44 },
	{ 0x13b5, 0x00 },
	{ 0x13b6, 0x48 },
	{ 0x13b7, 0x00 },
	{ 0x13b8, 0x9c }, /* Denoise */
	{ 0x13b9, 0x21 },
	{ 0x13ba, 0x00 },
	{ 0x13bb, 0x14 },
	{ 0xfffe, 0x14 },
	{ 0x1ff4, 0x00 },
	{ 0x1ff5, 0x00 },
	{ 0x1ff6, 0x00 },
	{ 0x1ff7, 0x03 },
	{ 0x1f84, 0x00 },
	{ 0x1f85, 0x14 },
	{ 0x1f86, 0x12 },
	{ 0x1f87, 0x24 },
	{ 0x1f88, 0x00 },
	{ 0x1f89, 0x14 },
	{ 0x1f8a, 0x10 },
	{ 0x1f8b, 0x0c },
	{ 0x0070, 0x00 },
	{ 0xfffe, 0x80 },
	{ 0x000e, 0x54 },
	{ 0xfffd, 0x80 },
	{ 0xfffe, 0x14 },
	{ 0x003f, 0x01 },
	{ 0x003e, 0x60 },
	{ 0x0070, 0x00 },
	{ 0x0040, 0x00 },
	{ 0x0041, 0x00 },
	{ 0x0042, 0x3e },
	{ 0x0043, 0x01 },
	{ 0x0044, 0x3e },
	{ 0x0045, 0x02 },
	{ 0x0046, 0x00 },
	{ 0x0047, 0x00 },
	{ 0x0048, 0x00 },
	{ 0x0049, 0x00 },
	{ 0x004a, 0x00 },
	{ 0x004b, 0xff },
	{ 0x004c, 0x00 },
	{ 0x004d, 0xff },
	{ 0x004e, 0x00 },
	{ 0x004f, 0x00 },
	{ 0x0050, 0x00 },
	{ 0x0051, 0x00 },
	{ 0x0052, 0x00 },
	{ 0x0053, 0x00 },
	{ 0x0054, 0x00 },
	{ 0x0055, 0x00 },
	{ 0x0056, 0x00 },
	{ 0x0057, 0x00 },
	{ 0x0058, 0x00 },
	{ 0x0059, 0x00 },
	{ 0x005a, 0x00 },
	{ 0x005b, 0x00 },
	{ 0x005c, 0x00 },
	{ 0x005d, 0x00 },
	{ 0x005e, 0x00 },
	{ 0x005f, 0x00 },
	{ 0x0060, 0x3e },
	{ 0x0061, 0x08 },
	{ 0x0062, 0x3e },
	{ 0x0063, 0x09 },
	{ 0x0064, 0x00 },
	{ 0x0065, 0x00 },
	{ 0x0066, 0x00 },
	{ 0x0067, 0x00 },
	{ 0x007c, 0x00 },
	{ 0x007d, 0x00 },
	{ 0x007e, 0x03 },
	{ 0x0088, 0x08 },
	{ 0x0089, 0x08 },
	{ 0x008a, 0x08 },
	{ 0x008c, 0x06 },
	{ 0x008e, 0x9B },
	{ 0x008f, 0xf0 },
	{ 0x0090, 0x00 },
	{ 0x0091, 0x10 },
	{ 0x0083, 0x00 },
	{ 0x0082, 0x02 },
	{ 0x0094, 0x2e },
	{ 0x0095, 0xe0 },
	{ 0xfffe, 0x21 },
	{ 0x0051, 0x03 },
	{ 0x0680, 0x00 },
	{ 0x0681, 0x00 },
	{ 0x0682, 0x00 },
	{ 0x0683, 0x00 },
	{ 0x0684, 0x07 },
	{ 0x0685, 0x80 },
	{ 0x0686, 0x04 },
	{ 0x0687, 0x38 },
	{ 0x0688, 0x11 },
	{ 0x0689, 0x11 },
	{ 0x068a, 0x11 },
	{ 0x068b, 0x11 },
	{ 0x068c, 0x11 },
	{ 0x068d, 0x11 },
	{ 0x068e, 0x11 },
	{ 0x068f, 0x11 },
	{ 0x0690, 0x03 },
	{ 0xfffe, 0x14 },
	{ 0x0002, 0x01 },
	{ 0x0020, 0x01 },
	{ 0x0021, 0x00 },
	{ 0x0022, 0x01 },
	{ 0x003d, 0x45 },
	{ 0x0036, 0x0f },
	{ 0x0037, 0x04 },
	{ 0xfffd, 0x80 },
	{ 0xfffe, 0x21 },
	{ 0x0800, 0x19 },
	{ 0x0801, 0x0f },
	{ 0x0802, 0x0c },
	{ 0x0803, 0x0d },
	{ 0x0804, 0x11 },
	{ 0x0805, 0x20 },
	{ 0x0806, 0x05 },
	{ 0x0807, 0x02 },
	{ 0x0808, 0x02 },
	{ 0x0809, 0x02 },
	{ 0x080a, 0x04 },
	{ 0x080b, 0x07 },
	{ 0x080c, 0x02 },
	{ 0x080d, 0x00 },
	{ 0x080e, 0x00 },
	{ 0x080f, 0x00 },
	{ 0x0810, 0x01 },
	{ 0x0811, 0x04 },
	{ 0x0812, 0x02 },
	{ 0x0813, 0x00 },
	{ 0x0814, 0x00 },
	{ 0x0815, 0x00 },
	{ 0x0816, 0x01 },
	{ 0x0817, 0x04 },
	{ 0x0818, 0x06 },
	{ 0x0819, 0x03 },
	{ 0x081a, 0x02 },
	{ 0x081b, 0x02 },
	{ 0x081c, 0x04 },
	{ 0x081d, 0x09 },
	{ 0x081e, 0x1b },
	{ 0x081f, 0x12 },
	{ 0x0820, 0x0f },
	{ 0x0821, 0x0f },
	{ 0x0822, 0x16 },
	{ 0x0823, 0x26 },
	{ 0x0824, 0x03 },
	{ 0x0825, 0x25 },
	{ 0x0826, 0x23 },
	{ 0x0827, 0x25 },
	{ 0x0828, 0x05 },
	{ 0x082a, 0x21 },
	{ 0x082b, 0x21 },
	{ 0x082c, 0x21 },
	{ 0x082d, 0x21 },
	{ 0x082e, 0x21 },
	{ 0x0830, 0x21 },
	{ 0x0831, 0x21 },
	{ 0x0832, 0x21 },
	{ 0x0833, 0x21 },
	{ 0x0834, 0x01 },
	{ 0x0836, 0x23 },
	{ 0x0837, 0x21 },
	{ 0x0838, 0x21 },
	{ 0x0839, 0x21 },
	{ 0x083a, 0x23 },
	{ 0x083c, 0x25 },
	{ 0x083d, 0x25 },
	{ 0x083e, 0x23 },
	{ 0x083f, 0x25 },
	{ 0x0840, 0x05 },
	{ 0x0848, 0xef },
	{ 0xfffe, 0x21 },
	{ 0x084d, 0x01 },
	{ 0x084e, 0x99 },
	{ 0x084f, 0x02 },
	{ 0x0850, 0xD8 },
	{ 0x0851, 0x02 },
	{ 0x0852, 0x22 },
	{ 0x0853, 0x01 },
	{ 0x0854, 0xE5 },
	/* AWB */
	{ 0xfffd, 0x80 },
	{ 0xfffe, 0x14 },
	{ 0x02b3, 0x01 },
	{ 0x02b6, 0x06 },
	{ 0x02b7, 0x00 },
	{ 0x02ba, 0x04 },
	{ 0x02bb, 0x00 },
	{ 0x02be, 0x04 },
	{ 0x02bf, 0x00 },
	{ 0x02c2, 0x04 },
	{ 0x02c3, 0x04 },
	{ 0x030a, 0x05 },
	{ 0x030b, 0x00 },
	{ 0x030c, 0x04 },
	{ 0x030d, 0x00 },
	{ 0x030e, 0x05 },
	{ 0x030f, 0xa0 },
	{ 0xfffe, 0x14 },
	{ 0x02b3, 0x00 },
	{ 0x0000, 0x01 },
	{ 0x02b0, 0x00 },
	{ 0x02b2, 0x01 },
	{ 0x02d6, 0x0d },
	{ 0x02d7, 0xff },
	{ 0xfffe, 0x21 },
	{ 0x0091, 0xb0 },
	{ 0x0092, 0x10 },
	{ 0x0001, 0x80 },
	{ 0x0003, 0xb1 },
	{ 0x0051, 0x00 },
	{ 0x0096, 0x83 },
	{ 0x019c, 0x0a },
	{ 0x0019, 0x48 },

	{ 0x01b0, 0x66 }, /* awb */
	{ 0x01b1, 0x91 },
	{ 0x01b2, 0x34 },
	{ 0x01b3, 0x46 },
	{ 0x01b4, 0x5c },
	{ 0x01b5, 0x6d },
	{ 0x01b6, 0x3c },
	{ 0x01b7, 0x4a },
	{ 0x01b8, 0x6a },
	{ 0x01b9, 0x8a },
	{ 0x01ba, 0x45 },
	{ 0x01bb, 0x5d },
	{ 0x01bc, 0x50 },
	{ 0x01bd, 0x6c },
	{ 0x01be, 0x47 },
	{ 0x01bf, 0x70 },
	{ 0x01c0, 0x6b },
	{ 0x01c1, 0x80 },
	{ 0x01c2, 0x58 },
	{ 0x01c3, 0x72 },
	{ 0x01c4, 0x00 },
	{ 0x01c5, 0x00 },
	{ 0x01c6, 0x00 },
	{ 0x01c7, 0x00 },
	{ 0x01c8, 0x00 },
	{ 0x01c9, 0x00 },
	{ 0x01ca, 0x00 },
	{ 0x01cb, 0x00 },
	{ 0x01cc, 0x00 },
	{ 0x01cd, 0x00 },
	{ 0x01ce, 0x00 },
	{ 0x01cf, 0x00 },
	{ 0x01d0, 0x00 },
	{ 0x01d1, 0x00 },
	{ 0x01d2, 0x00 },
	{ 0x01d3, 0x00 },
	{ 0x01d4, 0x00 },
	{ 0x01d5, 0x00 },
	{ 0x01d6, 0x00 },
	{ 0x01d7, 0x00 },
	{ 0x01d8, 0x00 },
	{ 0x01d9, 0x00 },
	{ 0x01da, 0x00 },
	{ 0x01db, 0x00 },
	{ 0x01dc, 0x00 },
	{ 0x01dd, 0x00 },
	{ 0x01de, 0x00 },
	{ 0x01df, 0x00 },
	{ 0x01e0, 0x00 },
	{ 0x01e1, 0x00 },
	{ 0x01e2, 0x00 },
	{ 0x01e3, 0x00 },
	{ 0x01e4, 0x00 },
	{ 0x01e5, 0x00 },
	{ 0x01e6, 0x00 },
	{ 0x01e7, 0x00 },
	{ 0x01e8, 0x00 },
	{ 0x01e9, 0x00 },
	{ 0x01ea, 0x00 },
	{ 0x01eb, 0x00 },
	{ 0x01ec, 0x00 },
	{ 0x01ed, 0x00 },
	{ 0x01ee, 0x00 },
	{ 0x01ef, 0x00 },
	{ 0x01f0, 0x22 },
	{ 0x01f1, 0x22 },
	{ 0x01f2, 0x10 },
	{ 0x01f3, 0x00 },
	{ 0x01f4, 0x00 },
	{ 0x01f5, 0x00 },
	{ 0x01f6, 0x00 },
	{ 0x01f7, 0x00 },

	{ 0xfffd, 0x80 },
	{ 0xfffe, 0x21 },
	{ 0x0480, 0x08 },
	{ 0x0481, 0x10 },
	{ 0x0482, 0x20 },
	{ 0x0483, 0x43 },
	{ 0x0484, 0x54 },
	{ 0x0485, 0x63 },
	{ 0x0486, 0x71 },
	{ 0x0487, 0x7d },
	{ 0x0488, 0x87 },
	{ 0x0489, 0x90 },
	{ 0x048a, 0x9f },
	{ 0x048b, 0xa9 },
	{ 0x048c, 0xb6 },
	{ 0x048d, 0xc0 },
	{ 0x048e, 0xcc },
	{ 0x048f, 0x15 },

	{ 0x0D00, 0x03 }, /* DAY */
	{ 0x0D01, 0x0f },
	{ 0x0D02, 0x03 },
	{ 0x0D03, 0x9a },
	{ 0x0D04, 0x02 },
	{ 0x0D05, 0x93 },
	{ 0x0D06, 0x01 },
	{ 0x0D07, 0x27 },
	{ 0x0D08, 0x00 },
	{ 0x0D09, 0x1f },
	{ 0x0D0A, 0x05 },
	{ 0x0D0B, 0x97 },
	{ 0x0D0C, 0x07 }, /* ALIGHT */
	{ 0x0D0D, 0xC2 },
	{ 0x0D0E, 0x08 },
	{ 0x0D0F, 0x08 },
	{ 0x0D10, 0x01 },
	{ 0x0D11, 0x72 },
	{ 0x0D12, 0x01 },
	{ 0x0D13, 0x65 },
	{ 0x0D14, 0x03 },
	{ 0x0D15, 0x1D },
	{ 0x0D16, 0x00 },
	{ 0x0D17, 0x68 },
	{ 0x0D18, 0x05 }, /* CWF */
	{ 0x0D19, 0x68 },
	{ 0x0D1A, 0x05 },
	{ 0x0D1B, 0x5E },
	{ 0x0D1C, 0x01 },
	{ 0x0D1D, 0x12 },
	{ 0x0D1E, 0x00 },
	{ 0x0D1F, 0xC7 },
	{ 0x0D20, 0x01 },
	{ 0x0D21, 0x94 },
	{ 0x0D22, 0x00 },
	{ 0x0D23, 0xF0 },
	{ 0x0d2e, 0x00 }, /* sign */
	{ 0x0D2F, 0x01 },
	{ 0x0D30, 0x00 },
	{ 0x0D31, 0x03 },
	{ 0x0d28, 0x00 },
	{ 0x0D29, 0x7A },
	{ 0x0D2A, 0x00 },
	{ 0x0D2B, 0xB6 },
	{ 0x0D2C, 0x01 },
	{ 0x0D2D, 0x03 },

	{ 0xfffd, 0x80 },
	{ 0xfffe, 0x21 },
	{ 0x0301, 0x10 },
	{ 0x0303, 0x6f },
	{ 0x0304, 0x00 },
	{ 0x0305, 0x10 },
	{ 0x0306, 0x00 },
	{ 0x0307, 0x00 },
	{ 0x0308, 0x30 },
	{ 0x0309, 0x00 },
	{ 0x030a, 0x03 },
	{ 0x030b, 0x02 },
	{ 0x030c, 0x04 },
	{ 0x030d, 0x18 },
	{ 0x030e, 0x18 },
	{ 0x030f, 0xc0 },
	{ 0x0310, 0x20 },
	{ 0x0311, 0xff },
	{ 0x0312, 0x80 },
	{ 0x0313, 0x18 },
	{ 0x0314, 0x08 },
	{ 0x0315, 0x3f },
	{ 0x0317, 0x06 },
	{ 0x0318, 0x00 },
	{ 0x0319, 0x1f },
	{ 0x031a, 0x00 },
	{ 0x031b, 0x10 },
	{ 0x031c, 0x00 },
	{ 0x031d, 0x10 },
	{ 0x031e, 0x10 },
	{ 0x031f, 0x18 },
	{ 0xfffd, 0x80 },
	{ 0xfffe, 0x21 },
	{ 0x0290, 0x06 },
	{ 0x0291, 0x08 },
	{ 0x0292, 0x00 },
	{ 0x029a, 0x00 },
	{ 0x029b, 0x02 },
	{ 0x029c, 0x04 },
	{ 0x029d, 0x06 },
	{ 0x029e, 0x08 },
	{ 0x029f, 0x09 },
	{ 0x02a0, 0x0a },
	{ 0xfffd, 0x80 },
	{ 0xfffe, 0x14 },
	{ 0x02b3, 0x00 },
	{ 0xfffe, 0x14 },
	{ 0x0000, 0x01 },
	{ 0x0001, 0x00 },
	{ 0x0002, 0x01 },
	{ 0x0003, 0x00 },
	{ 0x0004, 0x00 },
	{ 0xfffe, 0x21 },
	{ 0x0000, 0x47 },
	{ 0x0001, 0x80 }, /* write 80 if RGB_cmx on */
	{ 0x0003, 0xf1 },

	{ 0x0580, 0x09 },
	{ 0x0581, 0x38 },
	{ 0x0582, 0x38 },
	{ 0x0584, 0x23 },
};

/* SC2363P 1080p */
static const cc_reg_t sc2363p_init_reg_list[] = {
	{ 0x0103, 0x01 }, /* 74.25 sysclk 297M cntclk */
	{ 0x0100, 0x00 },

	{ 0x3034, 0x81 }, /* pll2 bypass */
	{ 0x3039, 0xd4 }, /* pll1 bypass */

	/* close mipi */
	/*
	 *{ 0x3018, 0x1f },
	 *{ 0x3019, 0xff },
	 *{ 0x301c, 0xb4 },
	 */

	{ 0x320c, 0x0a },
	{ 0x320d, 0x50 }, /* a80->a50 */

	{ 0x3e01, 0x23 },

	{ 0x363c, 0x05 }, /* 04 */
	{ 0x3635, 0xa8 }, /* c0 */
	{ 0x363b, 0x0d }, /* 0d */

	{ 0x3620, 0x08 },
	{ 0x3622, 0x02 },
	{ 0x3635, 0xc0 }, /* */
	{ 0x3908, 0x10 },

	{ 0x3624, 0x08 },
	/* count_clk inv need debug flash row
	 * in one channel
	 */
	{ 0x5000, 0x06 }, /* rts column test */
	{ 0x3e06, 0x00 },
	{ 0x3e08, 0x03 },
	{ 0x3e09, 0x10 },
	{ 0x3333, 0x10 },
	{ 0x3306, 0x7e },

	/*
	 *{ 0x3e08, 0x1f },
	 *{ 0x3e09, 0x1f },
	 *{ 0x3e06, 0x03 },
	 */
	{ 0x3902, 0x05 },
	/*
	 *{ 0x3909, 0x01 },auto blc
	 *{ 0x390a, 0xf5 },auto blc
	 */

	{ 0x3213, 0x08 },

	{ 0x337f, 0x03 },
	/* new auto precharge  330e in 3372   [7:6]
	 * 11: close div_rst 00:open div_rst
	 */
	{ 0x3368, 0x04 },
	{ 0x3369, 0x00 },
	{ 0x336a, 0x00 },
	{ 0x336b, 0x00 },
	{ 0x3367, 0x08 },
	{ 0x330e, 0x30 },

	{ 0x3366, 0x7c }, /* div_rst gap */

	{ 0x3633, 0x42 },

	{ 0x330b, 0xe0 },

	{ 0x3637, 0x57 },

	{ 0x3302, 0x1f },
	/* adjust the gap betwen first and second cunt_en
	 * pos edage to even times the clk
	 */
	{ 0x3309, 0xde },
	/* adjust the gap betwen first and second cunt_en
	 * pos edage to even times the clk
	 */
#if CCC_NO_USE
	{ 0x303f, 0x81 }, /* pclk sel pll_sclk_dig_div */
#endif

	/* leage current */

	{ 0x3907, 0x00 },
	{ 0x3908, 0x61 },
	{ 0x3902, 0x45 },
	{ 0x3905, 0xb8 },
#if CCC_NO_USE
	{ 0x3904, 0x06 }, /* 10.18 */
#endif
	{ 0x3e01, 0x8c },
	{ 0x3e02, 0x10 },
	{ 0x3e06, 0x00 },

	{ 0x3038, 0x48 },
	{ 0x3637, 0x5d },
	{ 0x3e06, 0x00 },

	/* 0921 */
	{ 0x3908, 0x11 },

	{ 0x335e, 0x01 }, /* ana dithering */
	{ 0x335f, 0x03 },
	{ 0x337c, 0x04 },
	{ 0x337d, 0x06 },
	{ 0x33a0, 0x05 },
	{ 0x3301, 0x04 },

	{ 0x3633, 0x4f }, /* prnu */

	{ 0x3622, 0x06 }, /* blksun */
	{ 0x3630, 0x08 },
	{ 0x3631, 0x84 },
	{ 0x3306, 0x30 },

	{ 0x366e, 0x08 }, /* ofs auto en [3] */
	{ 0x366f, 0x22 }, /* ofs + finegain  real ofs in 0x3687[4:0] */

	{ 0x3637, 0x59 }, /*  FW to 4.6k // 9.22 */

	{ 0x3320, 0x06 }, /* New ramp offset timing */
#if CCC_NO_USE
	{ 0x3321, 0x06 },
#endif
	{ 0x3326, 0x00 },
	{ 0x331e, 0x11 },
	{ 0x331f, 0xc1 },
	{ 0x3303, 0x20 },
	{ 0x3309, 0xd0 },
	{ 0x330b, 0xbe },
	{ 0x3306, 0x36 },

	{ 0x3635, 0xc2 }, /* TxVDD, HVDD */
	{ 0x363b, 0x0a },
	{ 0x3038, 0x88 },

	/* 9.22 */
	{ 0x3638, 0x1f }, /* ramp_gen by sc  0x30 */
	{ 0x3636, 0x25 }, /* */
	{ 0x3625, 0x02 },
	{ 0x331b, 0x83 },
	{ 0x3333, 0x30 },

	/* 10.18 */
	{ 0x3635, 0xa0 },
	{ 0x363b, 0x0a },
	{ 0x363c, 0x05 },

	{ 0x3314, 0x13 }, /* preprecharge */

	/* 20171101 reduce hvdd pump lighting */
	{ 0x3038, 0xc8 }, /* high pump clk, low lighting */
	{ 0x363b, 0x0b }, /* high hvdd, low lighting */
	{ 0x3632, 0x18 }, /* large current, low ligting  0x38 (option) */

	/* 20171102 reduce hvdd pump lighting */
	{ 0x3038, 0xff }, /* high pump clk, low lighting */

	{ 0x3639, 0x09 },
	{ 0x3621, 0x28 },
	{ 0x3211, 0x0c },

	/* 20171106 */
	{ 0x366f, 0x26 },

	/* 20171121 */
	{ 0x366f, 0x2f },
	{ 0x3320, 0x01 },
	{ 0x3306, 0x48 },
	{ 0x331e, 0x19 },
	{ 0x331f, 0xc9 },
	{             },
	{ 0x330b, 0xd3 },
	{ 0x3620, 0x28 },

	/* 20171122 */
	{ 0x3309, 0x60 },
	{ 0x331f, 0x59 },
	{ 0x3308, 0x10 },
	{ 0x3630, 0x0c },

	/* digital ctrl */
	{ 0x3f00, 0x07 },   /* bit[2] = 1 */
	{ 0x3f04, 0x05 },
	{ 0x3f05, 0x04 },   /* hts / 2 - 0x24 */
	{             },
	{ 0x3802, 0x01 },
	{ 0x3235, 0x08 },
	{ 0x3236, 0xc8 },  /* vts x 2 - 2 */

	/* 20171127 */
	{ 0x3630, 0x1c },

	/* 20171130 */
	{ 0x33aa, 0x10 }, /* low power */

	/* 20171208  logical   inter */
	{ 0x3670, 0x04 }, /* 0x3631 3670[2] enable  0x3631 in 0x3682 */
	{ 0x3677, 0x86 }, /* gain < gain0  0629 */
	{ 0x3678, 0x88 }, /* gain0 =< gain < gain1 */
	{ 0x3679, 0x88 }, /* gain >= gain1 */
	{ 0x367e, 0x08 }, /* gain0 {3e08[4:2], 3e09[3:1]} */
	{ 0x367f, 0x28 }, /* gain1 */

	{ 0x3670, 0x0c },
	/* 0x3633 3670[3] enable  0x3633 in 0x3683
	 * 20171227
	 */
	{ 0x3690, 0x33 }, /* gain < gain0  // 0629 */
	{ 0x3691, 0x11 }, /* gain0 =< gain < gain1 */
	{ 0x3692, 0x43 }, /* gain >= gain1  0629 */
	{ 0x369c, 0x08 }, /* gain0 {3e08[4:2], 3e09[3:1]} */
	{ 0x369d, 0x28 }, /* gain1 */
	{             },
	{ 0x360f, 0x01 }, /* 0x3622 360f[0] enable  0x3622 in 0x3680 */
	{ 0x3671, 0xc6 }, /* gain < gain0 */
	{ 0x3672, 0x06 }, /* gain0 =< gain < gain1 */
	{ 0x3673, 0x16 }, /* gain >= gain1 */
	{ 0x367a, 0x28 }, /* gain0 {3e08[4:2], 3e09[3:1]} */
	{ 0x367b, 0x3f }, /* gain1 */

	/* 20171218  30fps */
	{ 0x320c, 0x08 }, /* hts  2200 */
	{ 0x320d, 0x98 },
	{ 0x320e, 0x04 }, /* vts  1125 */
	{ 0x320f, 0x65 },
	/* digital ctrl */
	{ 0x3f04, 0x04 },
	{ 0x3f05, 0x28 },   /* hts / 2 - 0x24 */
	{ 0x3235, 0x08 },
	{ 0x3236, 0xc8 },  /* vts x 2 - 2 */

	/* 20171225 BLC power save mode */
	{ 0x3222, 0x29 },
	{ 0x3901, 0x02 },
	{ 0x3905, 0x98 },

	/* 20171227 */
	{ 0x3e1e, 0x34 },  /* digital finegain enable */

	/* 20180113 */
	{ 0x3314, 0x08 },

	/* 20180408 */
	{ 0x3900, 0x19 },  /* frame average */
	{ 0x391d, 0x04 },  /* digital dithering 0x01: open dithering @1x */
	{ 0x391e, 0x00 },

	/* 0629 */
	{ 0x3641, 0x01 },
	{ 0x3213, 0x04 },
	{ 0x3614, 0x80 },  /* rs_lo to pad */
	{ 0x363b, 0x08 },
	{ 0x363a, 0x9f },
	{ 0x3630, 0x9c },

	{ 0x3301, 0x0f },  /* 1127 [5, 10] */
	{ 0x3306, 0x48 },  /* 20180916[hl, bs][1, 36, 4c][2, 38, 4c] */
	{ 0x3632, 0x08 },

	{ 0x330b, 0xcd },
	/* [c6, dd]
	 * 20180916[bs,of][1,c8,dd][2,c9,dd][3,c9,dd]
	 */
	/* 20180917 mipi */
	{ 0x3018, 0x33 }, /* [7:5] lane_num-1 */
	{ 0x3031, 0x0a }, /* [3:0] bitmode */
	{ 0x3037, 0x20 }, /* [6:5] bitsel */
	{ 0x3001, 0xFE }, /* [0] c_y */


	/* lane_dis of lane3~8 */
	/*
	 *{ 0x3018, 0x12 },
	 *{ 0x3019, 0xfc },
	 */
	{ 0x4603, 0x00 }, /* [0] data_fifo mipi mode */
	{ 0x4827, 0x48 }, /* [7:0] hs_prepare_time[7:0] */
	{ 0x301c, 0x78 }, /* close dvp */
	{ 0x4809, 0x01 },
	{ 0x3314, 0x04 },
	{ 0x303c, 0x0e },
	{ 0x4837, 0x35 }, /* [7:0] pclk period * 2 */

	/* 20180919 */

	/* blc max */
	{ 0x3933, 0x0a },
	{ 0x3934, 0x10 },
	{ 0x3940, 0x60 },
	{ 0x3942, 0x02 },
	{ 0x3943, 0x1f },
	/* blc temp */
	{ 0x3960, 0xba },
	{ 0x3961, 0xae },
	{ 0x3962, 0x09 },
	{ 0x3966, 0xba },
	{ 0x3980, 0xa0 },
	{ 0x3981, 0x40 },
	{ 0x3982, 0x18 },
	{ 0x3903, 0x08 },
	{ 0x3984, 0x08 },
	{ 0x3985, 0x20 },
	{ 0x3986, 0x50 },
	{ 0x3987, 0xb0 },
	{ 0x3988, 0x08 },
	{ 0x3989, 0x10 },
	{ 0x398a, 0x20 },
	{ 0x398b, 0x30 },
	{ 0x398c, 0x60 },
	{ 0x398d, 0x20 },
	{ 0x398e, 0x10 },
	{ 0x398f, 0x08 },
	{ 0x3990, 0x60 },
	{ 0x3991, 0x24 },
	{ 0x3992, 0x15 },
	{ 0x3993, 0x08 },
	{ 0x3994, 0x0a },
	{ 0x3995, 0x20 },
	{ 0x3996, 0x38 },
	{ 0x3997, 0xa0 },
	{ 0x3998, 0x08 },
	{ 0x3999, 0x10 },
	{ 0x399a, 0x18 },
	{ 0x399b, 0x30 },
	{ 0x399c, 0x30 },
	{ 0x399d, 0x18 },
	{ 0x399e, 0x10 },
	{ 0x399f, 0x08 },
	{ 0x3934, 0x18 },
	{ 0x3985, 0x40 },
	{ 0x3986, 0x80 },
	{ 0x3985, 0x18 }, /* 20190507 */
	{ 0x3986, 0x28 },
	{ 0x3987, 0x70 },
	{ 0x3990, 0x40 },
	{ 0x3997, 0x70 },

	/* 20180926 */
	{ 0x3637, 0x55 },
	{ 0x363b, 0x06 },
	{ 0x366f, 0x2c },
	{ 0x330b, 0xcd },
	/* 0x3306 = 0x48
	 * 20180926[bs,of][1,c8,e1][2,c8,e1][3,c8,e1]
	 */
	{ 0x3306, 0x48 },
	/* 0x330b = 0xcd
	 * 20180926[hl, bs][1,3a,4c][2,3a,4c][3,3a,4c]
	 */
	/* 20180927 */
	{ 0x5000, 0x06 }, /* dpc enable(Hbin & Hsub? 0x46) */
	{ 0x5780, 0x7f }, /* auto dpc */
	{ 0x5781, 0x04 }, /* white dead pixel threshold0 */
	{ 0x5782, 0x03 }, /* white dead pixel threshold1 */
	{ 0x5783, 0x02 }, /* white dead pixel threshold2 */
	{ 0x5784, 0x01 }, /* white dead pixel threshold3 */
	{ 0x5785, 0x18 }, /* black dead pixel threshold0 */
	{ 0x5786, 0x10 }, /* black dead pixel threshold1 */
	{ 0x5787, 0x08 }, /* black dead pixel threshold2 */
	{ 0x5788, 0x02 }, /* black dead pixel threshold3 */
	{ 0x57a0, 0x00 }, /* gain threshold1 = 2x */
	{ 0x57a1, 0x71 },
	{ 0x57a2, 0x01 }, /* gain threshold1 = 8x */
	{ 0x57a3, 0xf1 },

	/* 20180928 high temp */
	{ 0x395e, 0xc0 },
	{ 0x3962, 0x89 },

	/* 20181112 */
	{ 0x3039, 0xd4 }, /* vco 390M */
	{ 0x303a, 0xb3 }, /* sysclk  78M */
	{ 0x303b, 0x06 },
	{ 0x303c, 0x0e },
	{ 0x3034, 0x81 }, /* cunt clk 312M */
	{ 0x3035, 0x9b },
	{ 0x320c, 0x08 }, /* 2080 hts */
	{ 0x320d, 0x20 },
	{ 0x320e, 0x04 }, /* 1250 vts */
	{ 0x320f, 0xe2 },
	{ 0x3f04, 0x03 },
	{ 0x3f05, 0xec }, /* hts / 2 - 0x24 */
	{ 0x3235, 0x09 },
	{ 0x3236, 0xc2 }, /* vts x 2 - 2 */
	{ 0x4837, 0x33 },
	{ 0x3802, 0x00 },

#if CCC_NO_USE
	{ 0x330b, 0xcd }, /* 20181113[ns, of][ca, e0] */
	{ 0x3306, 0x48 }, /* 20181113[hl,bs][1,3a,4c][2,3a,4c][3,3c,4c] */
#endif

	/* 20190114 */
	{ 0x3963, 0x80 }, /* edges brighting when high temp */

	/* 20190125 */
	{ 0x3039, 0xa4 }, /* pll1 vco = 24/ 2*2*2.5*13 = 780 */
	{ 0x303b, 0x16 }, /* sclk = vco/ 2 = 390 */

	/* 20190218 */
	{ 0x301f, 0x05 }, /* setting id */

	/* 20190320	 mirror & flip */
	{ 0x3902, 0xc5 },

	/* init */
	{ 0x3e00, 0x00 }, /* max exp = vts*2-4, min exp = 0 */
	{ 0x3e01, 0x9c },
	{ 0x3e02, 0x00 },
	{ 0x3e03, 0x0b }, /* gain mode */
	{ 0x3e06, 0x00 }, /* gain = 1x */
	{ 0x3e07, 0x80 },
	{ 0x3e08, 0x03 },
	{ 0x3e09, 0x10 },
	{ 0x3301, 0x12 },  /* 1127 [5, 10] */
	{ 0x3632, 0x08 },

	{ 0x3034, 0x01 }, /* pll2 enable */
	{ 0x3039, 0x24 }, /* pll1 enable */

	{ 0x0100, 0x01 },
};

static const cc_reg_t xc6130_bypass_on_list[] = {
	{ 0xfffd, 0x80 },
	{ 0xfffe, 0x80 },
	{ 0x004d, 0x01 },
};

static const cc_reg_t xc6130_bypass_off_list[] = {
	{ 0xfffd, 0x80 },
	{ 0xfffe, 0x80 },
	{ 0x004d, 0x00 },
};

static struct cc_power_act power_up_act[] = {
	{CC_RESET, CC_DOWN},
	{CC_DELAY, 5},
	{CC_RESET,  CC_UP},
	{CC_DELAY, 20},
};

static struct cc_power_act power_down_act[] = {
	{CC_RESET, CC_DOWN},
	{CC_DELAY, 10},
};

#define SC2363P_1080P_WIDTH		1920
#define SC2363P_1080P_HEIGHT		1080

static const struct cc_frame_cfg frame_cfgs[] = {
	{
		.width = SC2363P_1080P_WIDTH,
		.height = SC2363P_1080P_HEIGHT,

		.framerate = { 1, 30 },	/* 30 fps */
		.mfreq = 768000000,	/* mipi-csi clock */
		.dlanes = 2,
		.mbus_code = MEDIA_BUS_FMT_YUYV8_2X8,
		.colorspace = V4L2_COLORSPACE_JPEG,
		.field = V4L2_FIELD_NONE,
	},
};

static int xc6130_detect(struct cc_sensor_info *cc_si)
{
	u8 tmp[2];
	int ret = 0;
	u16 id;

	cc_switch_i2c_dev(cc_si, 1);
	ret = cc_si->write_reg(cc_si, 0xFFFD, 0x80);
	if (ret != 0) {
		PRT_ERR("xc6130 write reg 0xFFFD val 0x80 error\n");
		return -ENODEV;
	}

	ret = cc_si->write_reg(cc_si, 0xFFFE, 0x80);
	if (ret != 0) {
		PRT_ERR("xc6130 write reg 0xFFFD val 0x80 error\n");
		return -ENODEV;
	}

	ret = cc_si->read_reg(cc_si, 0x0002, &tmp[0]);
	if (ret != 0) {
		PRT_ERR("xc6130 tmp[0]=%x\n", tmp[0]);
		return -ENODEV;
	}

	ret = cc_si->read_reg(cc_si, 0x0003, &tmp[1]);
	if (ret != 0) {
		PRT_ERR("xc6130 tmp[0]=%x,tmp[1]=%x\n", tmp[0], tmp[1]);
		return -ENODEV;
	}

	id = (tmp[0] << 8) | tmp[1];
	PRT_INFO("xc6130 id: 0x%04x.\n", id);

	if (id != 0x4358) {
		PRT_ERR("xc6130 ID wrong! (0x%04x != 0x4358)\n", id);
		return -ENODEV;
	}

	return 0;
}

static int sc2363p_detect(struct cc_sensor_info *cc_si)
{
	u8 tmp[2];
	int ret = 0;
	u16 id;

	cc_switch_i2c_dev(cc_si, 0);
	ret = cc_si->read_reg(cc_si, 0x3107, &tmp[0]);
	if (ret != 0) {
		PRT_ERR("sc2363p tmp[0]=%x\n", tmp[0]);
		return -ENODEV;
	}

	ret = cc_si->read_reg(cc_si, 0x3108, &tmp[1]);
	if (ret != 0) {
		PRT_ERR("sc2363p tmp[0]=%x,tmp[1]=%x\n", tmp[0], tmp[1]);
		return -ENODEV;
	}

	id = (tmp[0] << 8) | tmp[1];
	PRT_INFO("sc2363p id: 0x%04x.\n", id);

	if (id != 0x2238) {
		PRT_ERR("sc2363p ID wrong! (0x%04x != 0x2232)\n", id);
		return -ENODEV;
	}

	return 0;
}

static int sensor_detect(struct cc_sensor_info *cc_si)
{
	return xc6130_detect(cc_si);
}

static int xc6130_init(struct cc_sensor_info *cc_si)
{
	struct timespec ts_s;
	struct timespec ts_f;
	int ret = 0;

	PRT_INFO("\n");

	ret = xc6130_detect(cc_si);
	if (ret != 0)
		return ret;

	cc_switch_i2c_dev(cc_si, 1);
	ktime_get_ts(&ts_s);
	ret = cc_si->write_reg_list(cc_si, xc6130_init_reg_list,
					ARRAY_SIZE(xc6130_init_reg_list));
	if (ret != 0) {
		PRT_ERR("write xc6130_init_reg_list failed!\n");
		return -ENODEV;
	}
	ktime_get_ts(&ts_f);

	PRT_INFO("write xc6130_init_reg_list finish.\n");
	PRT_INFO("timeused %d %d\n", (int)(ts_f.tv_sec - ts_s.tv_sec),
		(int)(ts_f.tv_nsec - ts_s.tv_nsec));

	return 0;
}

static int sc2363p_init(struct cc_sensor_info *cc_si)
{
	struct timespec ts_s;
	struct timespec ts_f;
	int ret = 0;

	PRT_INFO("\n");

	ret = sc2363p_detect(cc_si);
	if (ret != 0)
		return ret;

	cc_switch_i2c_dev(cc_si, 0);
	ktime_get_ts(&ts_s);
	ret = cc_si->write_reg_list(cc_si, sc2363p_init_reg_list,
					ARRAY_SIZE(sc2363p_init_reg_list));
	if (ret != 0) {
		PRT_ERR("write sc2363p_init_reg_list failed!\n");
		return -ENODEV;
	}
	ktime_get_ts(&ts_f);

	PRT_INFO("write sc2363p_init_reg_list finish.\n");
	PRT_INFO("timeused %d %d\n", (int)(ts_f.tv_sec - ts_s.tv_sec),
		(int)(ts_f.tv_nsec - ts_s.tv_nsec));

	return 0;
}

static int xc6130_bypass_on(struct cc_sensor_info *cc_si)
{
	int ret = 0;

	ret = cc_si->write_reg_list(cc_si, xc6130_bypass_on_list,
					ARRAY_SIZE(xc6130_bypass_on_list));
	if (ret != 0)
		PRT_ERR("write xc6130_bypass_on_list failed!\n");
	return ret;
}

static int xc6130_bypass_off(struct cc_sensor_info *cc_si)
{
	int ret = 0;

	ret = cc_si->write_reg_list(cc_si, xc6130_bypass_off_list,
					ARRAY_SIZE(xc6130_bypass_off_list));
	if (ret != 0)
		PRT_ERR("write xc6130_bypass_off_list failed!\n");
	return ret;
}

static int sensor_init(struct cc_sensor_info *cc_si)
{
	int ret = 0;

	PRT_INFO("\n");

	cc_switch_i2c_dev(cc_si, 1);
	ret = xc6130_init(cc_si);
	if (ret != 0)
		return ret;

	sensor_msleep(10);
	ret = xc6130_bypass_on(cc_si);
	if (ret != 0)
		return ret;

	sensor_msleep(10);

	cc_switch_i2c_dev(cc_si, 0);
	ret = sc2363p_init(cc_si);
	if (ret != 0)
		return ret;

	cc_switch_i2c_dev(cc_si, 1);
	sensor_msleep(10);
	ret = xc6130_bypass_off(cc_si);
	if (ret != 0)
		return ret;
	sensor_msleep(50);

	return 0;
}

static int sensor_set_stream(struct cc_sensor_info *cc_si, int on)
{
	int ret = 0;

	return ret;
}

#define DRIVER_NAME "xc6130_sc2363p_mipi"

static int sensor_probe(struct platform_device *pdev)
{
	struct cc_sensor_info *cc_si = NULL;
	int ret = 0;

	PRT_INFO("*********probe begin\n");

	cc_si = devm_kzalloc(&pdev->dev, sizeof(*cc_si), GFP_KERNEL);
	if (cc_si == NULL) {
		PRT_ERR("Can't alloc memory!\n");
		return -ENOMEM;
	}

	cc_si->reg_bits = 16;
	cc_si->val_bits = 8;

	cc_si->name = "sc2363p";
	cc_si->ext_name = "xc6130";

	cc_si->power_up_act = power_up_act;
	cc_si->power_down_act = power_down_act;
	cc_si->npwr_up_acts = ARRAY_SIZE(power_up_act);
	cc_si->npwr_dn_acts = ARRAY_SIZE(power_down_act);

	cc_si->framecfgs = frame_cfgs;
	cc_si->nfrmcfgs = ARRAY_SIZE(frame_cfgs);

	ret = cc_sensor_probe(pdev, cc_si);
	if (ret < 0)
		return ret;

	cc_si->detect = sensor_detect;
	cc_si->sensor_init = sensor_init;
	cc_si->set_stream = sensor_set_stream;
	cc_si->sensor_ioctl = NULL;

	PRT_INFO("probe end\n");
	return 0;
}

static int sensor_remove(struct platform_device *pdev)
{
	struct cc_sensor_info *cc_si = platform_get_drvdata(pdev);

	cc_sensor_remove(pdev);

	devm_kfree(&pdev->dev, cc_si);

	return 0;
}

static const struct of_device_id xc6130_sc2363p_mipi_of_match[] = {
	{
		.compatible = DRIVER_NAME,
	},
	{ /* sentinel */ },
};
MODULE_DEVICE_TABLE(of, xc6130_sc2363p_mipi_of_match);

static struct platform_driver xc6130_sc2363p_mipi_driver = {
	.driver = {
		.of_match_table	= xc6130_sc2363p_mipi_of_match,
		.name		= DRIVER_NAME,
		.owner		= THIS_MODULE,
	},
	.probe = sensor_probe,
	.remove = sensor_remove,
};

module_platform_driver(xc6130_sc2363p_mipi_driver);

MODULE_DESCRIPTION("XC6130_SC2363P-MIPI sensor driver");
MODULE_LICENSE("GPL v2");
MODULE_ALIAS("platform:" DRIVER_NAME);

